//
//  RemaindView.m
//  Marketing
//
//  Created by User on 16/5/29.
//  Copyright © 2016年 Hanen 3G 01. All rights reserved.
//

#import "RemaindView.h"

#define WIDTH [[UIScreen mainScreen] bounds].size.width
#define HEIGHT [[UIScreen mainScreen] bounds].size.height

#define LEFT_WIDTH (3.0f*(WIDTH/414.0))
#define VIEW_WIDTH (58.0f*(WIDTH/414.0))
#define VIEW_HEIGHT (50.0f*(WIDTH/414.0))
#define RILIVIEW_WIDTH 70.0f
NSMutableArray *roundArr;

@implementation RemaindView
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        roundArr = [[NSMutableArray alloc] init];
        for (int i = 0; i < 42; i ++) {
            
            UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(VIEW_WIDTH*(i%7)+10*(WIDTH/414.0), 10*(HEIGHT/736.0)+VIEW_HEIGHT*ceilf((float)(i/7)), 40*(WIDTH/414.0), 40*(HEIGHT/736.0))];
            image.image = [UIImage imageNamed:@"HY_date_icon_point_normal"];
            image.tag = i+1;
            
            image.hidden = YES;
            [self addSubview:image];
            [roundArr addObject:image];
        }
        
    }
    return self;
}

- (void)setArr:(NSMutableArray *)arr oneMonth:(int)MonthOne
{
    _remArr = arr;
    
    NSMutableArray *arr1 = [[NSMutableArray alloc] init];
    [arr1 removeAllObjects];
    
    for (int i = 0 ; i < MonthOne ; i ++) {
        UIImageView *image = [roundArr objectAtIndex:i];
        image.hidden = YES;
    }
    for (int i = 0 ; i < roundArr.count ; i ++) {
        if (i+MonthOne <42) {
            UIImageView *image = [roundArr objectAtIndex:i + MonthOne];
            image.hidden = YES;
            for (int i = 0 ; i < arr.count ; i ++) {
                
                if ( image.tag  == [[arr objectAtIndex:i] intValue]+MonthOne) {
                    
                    [arr1 addObject:image];
                }
            }
        }
    }
    for (UIImageView*im in arr1) {
        im.hidden = NO;
    }
    
}

@end
